/* 全局样式 */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: lightcoral;
}


/* 头部样式 */

header {
    background-color: orange;
    border-bottom: 1px solid orange;
    padding: 10px 0;
}

.header-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    float: left;
}

.logo img {
    height: 50px;
}

.search-bar {
    float: left;
    margin-left: 50px;
    margin-top: 10px;
}

.search-bar input {
    padding: 10px;
    border: 1px solid orange;
    border-radius: 4px 0 0 4px;
    width: 300px;
}

.search-bar button {
    padding: 10px 20px;
    background-color: #ff4400;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}


/* 搜索按钮悬停效果 */

.search-bar button:hover {
    background-color: #e63900;
}

.user-nav {
    float: right;
    margin-top: 20px;
}

.user-nav a {
    margin-left: 15px;
    text-decoration: none;
    color: #333;
}


/* 清除浮动 */

.clearfix:after {
    content: "";
    display: table;
    clear: both;
}


/* 导航栏样式 */

nav {
    background-color: orange;
    border-bottom: 1px solid orange;
}

.nav-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.main-nav a {
    display: inline-block;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
}


/* 导航栏链接悬停效果 */

.main-nav a:hover {
    color: #ff4400;
    background-color: #ffdab9;
}


/* 商品分类和轮播图区域样式 */

.content-container {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
}

.category-list {
    width: 5%;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    float: left;
}

.category-list ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    padding: 10px;
}

.category-list li a {
    text-decoration: none;
    color: #333;
}

.category-list li a:hover {
    color: #ff4400;
}

.slider {
    width: 75%;
    margin-left: 20px;
    height: 300px;
    position: relative;
    overflow: hidden;
    float: left;
}

.slider input {
    display: none;
}

.slider img {
    width: 100%;
    height: 100%;
    position: absolute;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}


/* 利用 :checked 伪类控制图片显示 */

#slide1:checked~.slides img:nth-child(1),
#slide2:checked~.slides img:nth-child(2),
#slide3:checked~.slides img:nth-child(3) {
    opacity: 1;
}


/* 模拟自动切换，利用 animation 关键帧 */

.slider .slides img {
    animation: slide 9s infinite;
}

.slider .slides img:nth-child(1) {
    animation-delay: 0s;
}

.slider .slides img:nth-child(2) {
    animation-delay: 3s;
}

.slider .slides img:nth-child(3) {
    animation-delay: 6s;
}

@keyframes slide {
    0%,
    30% {
        opacity: 1;
    }
    33%,
    97% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}


/* 热门商品推荐区域样式 */

.hot-products {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    clear: both;
}

.hot-products h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.product-item {
    /* 调整宽度，减去左右外边距后一行能放4个 */
    width: calc(25% - 20px);
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    float: left;
    margin: 0 10px 20px 10px;
    transition: box-shadow 0.3s ease-in-out;
}


/* 商品项悬停效果 */

.product-item:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.product-item img {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
}

.product-item h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.product-item p {
    color: #ff4400;
    font-weight: bold;
}


/* 页脚样式 */

footer {
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    padding: 20px 0;
    text-align: center;
    clear: both;
    background-color: lightblue;
}

footer p {
    margin: 0;
    color: grey;
    background-color: lightblue;
}